<?php
declare (strict_types = 1);

namespace app\mobile\controller;

use think\facade\Request;
use think\facade\Db;
use think\facade\Cache;

class News extends \app\mobile\controller\Base
{
  public function view()
  {
    $id = input('id');
    $table = input('table','news');
    $code = input('code');

    $query = [];
    if ($id) {
      $query[] = ['id','=',$id];
    }elseif ($code) {
      $query[] = ['code','=',$code];
    }
    
    $base = getSettingGroup('base');
    $vo = Db::name($table)->where($query)->find();
    $vo['ctime_txt'] = toDatetime($vo['ctime']);
    $vo['author'] = $base['app_name'];
    return $this->doSuccess('ok',$vo);
  }
}